<template>
	<el-container direction="vertical">
		<SearchForm :columns="formColumn" @search="search" @reset="search" />
		<el-header>
			<el-button type="primary" @click="dialogVisible = true">
				导出
			</el-button>

			<el-dialog v-model="dialogVisible" title="提示" width="30%" :before-close="handleClose">
				<span>是否确定导出文档</span>
				<template #footer>
					<span class="dialog-footer">
						<el-button @click="dialogVisible = false">取消</el-button>
						<el-button type="primary" @click="dialogVisible = false">
							确定
						</el-button>
					</span>
				</template>
			</el-dialog>
		</el-header>

		<el-main class="nopadding">
			<scTable ref="table" tableName="signedList" v-bind="apply" row-key="id" stripe :vritualData="vritualData">
				<el-table-column type="selection" width="50"></el-table-column>
				<template #name="scope">
					<el-link :underline="false" type="primary" :href="`#/student/detail/${scope.row.studentId}`">{{ scope.row.name
					}}</el-link>
				</template>
        <el-table-column
					label="操作"
					width="150"
					fixed="right"
					align="center"
				>
					<template #default="scope">
						<!-- <el-button
							plain
							size="small"
							@click="stopUsing(scope.row)"
							>打印</el-button> -->
							<el-button
							plain
							size="small"
							@click="editDetail(scope.row)"
							>查看</el-button>
					</template>
				</el-table-column>
			</scTable>
		</el-main>
	</el-container>
</template>
<script>
import SearchForm from "@/components/SearchForm/index.vue";
import { formColumn, column } from "./date";
import { ElMessageBox } from 'element-plus'


export default {
	data() {
		return {
			formColumn,
			apply: {
				apiObj: this.$API.student.signUpList,
				params: {},
				column,
			},
			dialogVisible: false,
			vritualData: [
				{
					1: '陈大厨',
					term: '暑假',
				},
				{
					1: '酒大仙',
					term: '寒假',
				},
				{
					1: '扫把星',
					term: '秋季',
				},
			]
		}

	},
	components: {
		SearchForm,
	},
	methods: {
		search(searchParams) {
			const params = Object.assign({}, this.apply.params, searchParams);
			this.$refs.table.reload(params);
		},
		handleClose() {
			ElMessageBox.confirm('是否确定关闭对话框?', '提示',
				{
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning',
				})
				.then(() => {
					this.dialogVisible = false
				})
				.catch(() => {
					// catch error
				})
		},
		stopUsing(row) {
			console.log(row, "我是打印");
		},
		editDetail(row) {
			console.log(row, "我是查看");
			this.$router.push({
				path: ""
			})
		},
	}
}




</script>
<style scoped>
.dialog-footer button:first-child {
	margin-right: 10px;
}
</style>
